from django.db import models
from django.contrib.auth.models import AbstractUser, Permission,Group


# Create your models here.

class CustomUser(AbstractUser):
    head = models.ImageField(upload_to="head/", default="head/default.jpg")
    # 解决 Group 反向冲突
    groups = models.ManyToManyField(
        Group,
        related_name='customuser_groups',  # 任意唯一名
        blank=True,
        help_text='The groups this user belongs to.',
        verbose_name='groups'
    )
    # 解决 Permission 反向冲突
    user_permissions = models.ManyToManyField(
        Permission,
        related_name='customuser_permissions',
        blank=True,
        help_text='Specific permissions for this user.',
        verbose_name='user permissions'
    )
